package com.wangxu.blog.utils;

import com.wangxu.blog.dao.pojo.SysUser;

public class UserThreadLocal {

    private UserThreadLocal(){

    }
    //线程变量隔离
    private static final ThreadLocal<SysUser> LOCAL = new ThreadLocal<>();

    /**
     * 设置值
     * @param sysUser 设置值的信息
     */
    public static void put(SysUser sysUser){
        LOCAL.set(sysUser);
    }

    /**
     * 获取值
     * @return 返回值
     */
    public static SysUser get(){
        return LOCAL.get();
    }

    /**
     * 删除信息
     */
    public static void remove(){
        LOCAL.remove();
    }
}
